package com.atguigu.boot04.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

/**
 * @author:朱思博
 * @date:2021/5/8-{17:19}   druid数据源配置类
 */
@Configuration
public class MyDataSourceConfig {



    // 由于druid的相关四个配置，属性名和jdbc都一样，所以直接绑定jdbc的
    @ConfigurationProperties("spring.datasource")
    @Bean
    public DataSource dataSource123() {

        DruidDataSource druidDataSource = new DruidDataSource();
//        druidDataSource.setUrl();
        return druidDataSource;
    }
}
